package com.yuexun.dhdoctor.module.healthRecord.ui;

import android.content.Intent;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.yuexun.dhdoctor.R;
import com.yuexun.dhdoctor.base.BaseKJActivity;
import com.yuexun.dhdoctor.module.contractmanage.ui.Act_ContractManageInspect;
import com.yuexun.dhdoctor.module.contractmanage.ui.Act_ContractManageRecord;
import com.yuexun.dhdoctor.module.contractmanage.ui.Act_ContractManageTest;
import com.yuexun.dhdoctor.module.healthRecord.bean.HealthRcordBean;


import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by work-jx on 2016/4/14.
 */
public class Act_HealthRecordDetail extends BaseKJActivity{
    @Bind(R.id.title_tv)
    TextView titleTv;
    @Bind(R.id.healthdetail_icon)
    ImageView healthdetailIcon;
    @Bind(R.id.healthdetail_name)
    TextView healthdetailName;
    @Bind(R.id.healthdetail_age)
    TextView healthdetailAge;
    @Bind(R.id.healthdetail_sex)
    TextView healthdetailSex;
    @Bind(R.id.healthdetail_tv_telephone)
    TextView healthdetailTvTelephone;
    @Bind(R.id.healthdetail_tv_card)
    TextView healthdetailTvCard;
    @Bind(R.id.healthdetail_tv_address)
    TextView healthdetailTvAddress;

    HealthRcordBean.RowsBean healthRecordListBean;

    @Override
    public void setRootView() {
        setContentView(R.layout.act_healthdetail);
        ButterKnife.bind(this);
    }

    @Override
    public void initData() {
        super.initData();
        setTitle();
        healthRecordListBean = (HealthRcordBean.RowsBean)getIntent().getExtras().get("HealthRecordListBean");
        healthdetailAge.setText("年龄: "+healthRecordListBean.getAge());
        healthdetailName.setText(healthRecordListBean.getName());
        if("1".equals(healthRecordListBean.getSex_code())) {
            healthdetailSex.setText("性别:  男");
        }
        else if("2".equals(healthRecordListBean.getSex_code()))
        {
            healthdetailSex.setText("性别:  女");
        }
        else if("9".equals(healthRecordListBean.getSex_code()))
        {
            healthdetailSex.setText("性别:  不详");
        }
        healthdetailTvTelephone.setText(healthRecordListBean.getPhone_tel());
        healthdetailTvCard.setText(healthRecordListBean.getPerson_id());
        healthdetailTvAddress.setText(healthRecordListBean.getHome_address());
    }

    protected void setTitle() {
        titleTv.setText("健康档案详情");
    }

    @Override
    @OnClick({R.id.healthdetail_record, R.id.healthdetail_inspect, R.id.healthdetail_test,R.id.back})
    public void onClick(View view) {
        Intent intent;
        switch (view.getId()) {
            case R.id.healthdetail_record:
                intent = new Intent(this, Act_ContractManageRecord.class);
                intent.putExtra("healthid",healthRecordListBean.getPerson_id());
                startActivity(intent);
                break;
            case R.id.healthdetail_inspect:
                intent = new Intent(this, Act_ContractManageInspect.class);
                intent.putExtra("healthid",healthRecordListBean.getPerson_id());
                startActivity(intent);
                break;
            case R.id.healthdetail_test:
                intent = new Intent(this, Act_ContractManageTest.class);
                intent.putExtra("healthid",healthRecordListBean.getPerson_id());
                startActivity(intent);
                break;
            case R.id.back:
                finish();
                break;
        }
    }

}
